<?php

function getProprioGoods($BDD_connexion) {
	
	$goods = array();
	
	$request = "SELECT * FROM bien,adresse WHERE bien.ref_proprio = :id AND bien.ref_adresse = adresse.id_adresse GROUP BY adresse.id_adresse";
	$prepare=$BDD_connexion->prepare($request);
	$prepare->bindValue(':id',$_SESSION['userid'],PDO::PARAM_INT);
	$prepare->execute();
	while ($good = $prepare->fetch(PDO::FETCH_OBJ))
	{
		$good->description = getLocationDescription($BDD_connexion,$good->id_bien);
		$goods[] = $good;
	}
	
	return $goods;
	
}

function deleteGood($BDD_connexion,$id_bien) {

	$request = "DELETE FROM bien WHERE id_bien = :id";
	$prepare=$BDD_connexion->prepare($request);
	$prepare->bindValue(":id",$id_bien,PDO::PARAM_INT);
	
	return $prepare->execute();

}

?>
